package com.ssm.service.Impl;

import com.ssm.dao.UserDao;
import com.ssm.entity.UserVo;
import com.ssm.service.UserService;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("userService")
public class UserServiceImpl implements UserService {
    @Resource
    private UserDao userDao;

   // @Cacheable(value = "simpleCache", key = "#userId")
   @Cacheable("selectUser")
    @Override
    public UserVo selectUser(long userId) {
        System.out.println("开始数据库查询");
        return this.userDao.selectUser(userId);
    }

    @Override
    public UserVo queryByUserName(String username) {
        return userDao.queryByUserName(username);
    }

    @Override
    public List<UserVo> queryAll() {
        return userDao.queryAll();
    }

    @Override
    public List<String> queryAllPerms(Long userId) {
        return userDao.queryAllPerms(userId);
    }
}
